/**
 * 
 */
package com.et114.modules.org.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//import org.acegisecurity.concurrent.SessionRegistry;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

//import com.et114.components.acegi.Constants;
import com.et114.core.action.BaseDispatchAction;

/**
 * @author guanhw
 */
public class CommonAction extends BaseDispatchAction {
	
	public ActionForward sessionHas ( ActionMapping mapping , ActionForm form ,
			HttpServletRequest request , HttpServletResponse response )
			throws Exception {
		/*
		response.setHeader ( "Pragma" , "No-cache" );
		response.setHeader ( "Cache-Control" , "no-cache" ); 
		javax.servlet.http.HttpSession session = request.getSession ( ) ; 
		java.io.PrintWriter out = response.getWriter ( ) ; 
		SessionRegistry sessionRegistry = ( SessionRegistry )getBean ( "sessionRegistry" ) ;
		if ( session  != null  ) {
			   Object obj = session.getAttribute( Constants.SESSION_CURRENT_USER_KEY  );
			   if ( obj != null ) {
					SessionUserInfo currentUser = getCurrentUser ( request ) ; 
					if ( sessionRegistry.getAllSessions ( currentUser.getLoginName ( ) , false ) == null ) {
						logger.info ( "session lost !" ) ;
						out.print( "lost" ) ;
						out.flush ( );
						out.close ( ) ;
						return null;
					}
					out.print( "has" ) ; 
			   }
			   
			   else {
				   	session.invalidate ( ) ;
				   	//request.getRequestDispatcher( "/commons/sessionlost.jsp" ).forward( request , response );			
				    out.print( "lost" ) ;
			   }
			   out.flush();		
			   out.close ( ) ;
		}		
		*/
		return null ; 
	}	
}
